export const flattenArr = (arr) => {
  return arr.reduce((c, item) => {
    c[item.id] = item;
    return c;
  }, {});
};

export const objToArr = (obj) => {
  return Object.keys(obj).map((c) => obj[c]);
};

export const getParentNode = (node, parentClassName) => {
  let current = node;
  while (current !== null) {
    if (current.classList.contains(parentClassName)) {
      return current;
    }
    current = current.parentNode;
  }
  return false;
};
